/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.uniandes.sar.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author LATITUDE
 */
@Entity
@Table(name = "sendavalor")
@NamedQueries({
    @NamedQuery(name = "Sendavalor.findAll", query = "SELECT s FROM Sendavalor s"),
    @NamedQuery(name = "Sendavalor.findByIdSendaValor", query = "SELECT s FROM Sendavalor s WHERE s.idSendaValor = :idSendaValor"),
    @NamedQuery(name = "Sendavalor.findByDescripcion", query = "SELECT s FROM Sendavalor s WHERE s.descripcion = :descripcion")})
public class Sendavalor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idSendaValor")
    private Integer idSendaValor;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sendavalor")
    private List<Requerimiento> requerimientoList;

    public Sendavalor() {
    }

    public Sendavalor(Integer idSendaValor) {
        this.idSendaValor = idSendaValor;
    }

    public Sendavalor(Integer idSendaValor, String descripcion) {
        this.idSendaValor = idSendaValor;
        this.descripcion = descripcion;
    }

    public Integer getIdSendaValor() {
        return idSendaValor;
    }

    public void setIdSendaValor(Integer idSendaValor) {
        this.idSendaValor = idSendaValor;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Requerimiento> getRequerimientoList() {
        return requerimientoList;
    }

    public void setRequerimientoList(List<Requerimiento> requerimientoList) {
        this.requerimientoList = requerimientoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSendaValor != null ? idSendaValor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sendavalor)) {
            return false;
        }
        Sendavalor other = (Sendavalor) object;
        if ((this.idSendaValor == null && other.idSendaValor != null) || (this.idSendaValor != null && !this.idSendaValor.equals(other.idSendaValor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.descripcion;
    }
    
}
